<?php
class Jobeet {
    static public function slugify($text) {
        
        //remplaza no caracteres o digitos por un guion -
        $text = preg_replace('#[^\\pL\d]+#u', '-', $text);
        
        // TRIM
        $text = trim($text, '-');
        
        //Transliteracion
        if(function_exists('iconv')) {
            $text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);
        }

        //Convertir a minusculas
        $text = strtolower($text);
        
        //Elimina caracteres no deseados
        $text = preg_replace('#[^-\w]+#', '', $text);
        
        if(empty($text)) return 'n-a';
        
        return $text;
    }
}
